import plugin from '../../lib/plugins/plugin.js';
import { segment } from 'oicq';

export class EstimateImagePlugin extends plugin {
  constructor() {
    super({
      name: '原铁绝预估',
      dsc: '若有指令重复可将priority优先级调至1000000',
      event: 'message',
      priority: -95000000000,
      rule: [
        {
          reg: /^#(预估|原石|星琼|菲林)(预估)?$/,
          fnc: 'sendGsEstimate'
        },
        {
          reg: /^#星铁(预估|原石|星琼|菲林)(预估)?$/,
          fnc: 'sendSrEstimate'
        },
        {
          reg: /^#绝区零(预估|原石|星琼|菲林)(预估)?$/,
          fnc: 'sendZzzEstimate'
        }
      ]
    });
  }

  /**
   * 发送原神预估图片
   */
  async sendGsEstimate(e) {
    // 使用segment构建图片消息，适配不同协议
    const image = segment.image('https://gitee.com/euiko/Panel/raw/img/预估/gs.png');
    await e.reply(image);
  }

  /**
   * 发送星铁预估图片
   */
  async sendSrEstimate(e) {
    const image = segment.image('https://gitee.com/euiko/Panel/raw/img/预估/sr.png');
    await e.reply(image);
  }

  /**
   * 发送绝区零预估图片
   */
  async sendZzzEstimate(e) {
    const image = segment.image('https://gitee.com/euiko/Panel/raw/img/预估/zzz.png');
    await e.reply(image);
  }
}
